import 'package:flutter_screenutil/screenutil.dart';
import 'package:flutter/material.dart';
import 'package:heyangkuaidai/DemonStrateModule/Components/BankCardItem.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:heyangkuaidai/DemonStrateModule/Components/NavigationBar.dart';
class LoanBindCardPage extends StatefulWidget {
  @override
  _LoanBindCardPageState createState() => _LoanBindCardPageState();
}

class _LoanBindCardPageState extends State<LoanBindCardPage> {
  @override
  Widget build(BuildContext context) {
    ScreenUtil.init(context, width: 375, height: 667, allowFontScaling: true);
    return Scaffold(
      resizeToAvoidBottomInset: false,
      body: Column(
        children: [
          SizedBox(height: MediaQuery.of(context).padding.top,),
          NavigationBar(false, title: "福祥e贷",),
          Container(
            width: ScreenUtil.screenWidth,
            height: ScreenUtil.screenHeight-ScreenUtil().setWidth(350)-MediaQuery.of(context).padding.top,
            child: ListView.separated(
              // ignore: missing_return
              itemBuilder: (context, itemIndex){
                return Slidable(
                  actionPane: SlidableScrollActionPane(),//滑出选项的面板 动画
                  actionExtentRatio: 0.25,
                  child: BankCardItem(bankname: "湖南省农村信用社联合社",cardNum: "储蓄卡 尾号(3466)"),
                  secondaryActions: <Widget>[//右侧按钮列表
                    IconSlideAction(
                      caption: '',
                      color: Colors.white,
                      iconWidget:Container(
                        child:Center(child:Text("删除",style: TextStyle(color: Color(0xffE60111),fontSize: ScreenUtil().setSp(14)),) ,) ,
                      ),
                      closeOnTap: false,
                      onTap: (){

                      },
                    ),
                  ],
                );

                // ignore: missing_return
              },separatorBuilder: (context, itemIndex){
              return Container(height: ScreenUtil().setWidth(20),);
            }, itemCount: 3,
              padding: EdgeInsets.only(left: ScreenUtil().setWidth(15),right: ScreenUtil().setWidth(15)),),
          ) ,
          SizedBox(height: ScreenUtil().setWidth(10),),
          Row(
            children: [
              SizedBox(width: ScreenUtil().setWidth(127),),
              Container(child: Image.asset("sources/yy/back.png"),width:ScreenUtil().setWidth(14),height: ScreenUtil().setWidth(14),),
              SizedBox(width: ScreenUtil().setWidth(6),),
              Container(
                width: ScreenUtil().setWidth(120),
                child:Text("左滑可删除卡信息",style: TextStyle(fontSize: ScreenUtil().setSp(12),color: Color(0xff9E9E9E)),textAlign: TextAlign.left,),
              ),
            ],
          ),
          SizedBox(height: ScreenUtil().setWidth(104),),
          InkWell(
            onTap: (){
              Navigator.pop(context);
            },
            child: Container(
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(4),
                  color:Color(0xff41A5EE),
                ),
                width: ScreenUtil().setWidth(347),
                height: ScreenUtil().setWidth(44),
                child:Center(
                  child: Text("新增卡",style: TextStyle(fontSize: ScreenUtil().setSp(17),color: Colors.white),textAlign: TextAlign.center,),
                )
            ) ,
          ),
          SizedBox(height: ScreenUtil().setWidth(20),),
          InkWell(
            onTap: (){
              Navigator.pop(context);
            },
            child: Container(
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(4),
                    color:Color(0xffFFFFFF),
                    border: Border.all(
                        color: Color(0xff41A5EE),
                        width: 1,
                        style: BorderStyle.solid
                    )
                ),
                width: ScreenUtil().setWidth(347),
                height: ScreenUtil().setWidth(44),
                child:Center(
                  child: Text("确定",style: TextStyle(fontSize: ScreenUtil().setSp(17),color: Color(0xff41A5EE)),textAlign: TextAlign.center,),
                )
            ) ,
          )
        ],
      ),
    );
  }
}
